package com.xxxx.server.controller;


import com.xxxx.server.pojo.RespBean;
import com.xxxx.server.pojo.Student;
import com.xxxx.server.service.TestService;
import com.xxxx.server.service.impl.TestServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test-student")
public class TestController {
    @Autowired
    TestService testService;

    @Autowired
    TestServiceImpl testServiceImpl;

    @GetMapping("select")
    public RespBean test4(@RequestParam Long id) {
        Student student = testService.selectStudent(id);
        return RespBean.success("成功", student);
    }

    @GetMapping("select-instructorRewardPunish")
    public RespBean selectIRP(@RequestParam Long id) {
        Student student = testService.selectStudent(id);
        return RespBean.success("成功", student);
    }

    @PostMapping("/add")
    public RespBean add(
            @RequestBody Student student) {
        testServiceImpl.add(student);

        return RespBean.success("成功", student);
    }

}
